home *** CD-ROM | disk | FTP | other *** search
/ Hardcore Gamer Resource Kit / Hardcore Gamer Resource Kit - Disc 3.iso / screensavers / saver25.zip / SOURCE.ZIP / midasdll.h < prev    next >
C/C++ Source or Header  |  1997-01-16  |  7KB  |  247 lines

  1. /*      midasdll.h
  2.  *
  3.  * MIDAS DLL programming interface
  4.  *
  5.  * $Id: midasdll.h,v 1.4 1997/01/16 18:41:59 pekangas Exp $
  6.  *
  7.  * Copyright 1996,1997 Housemarque Inc.
  8.  *
  9.  * This file is part of the MIDAS Sound System, and may only be
  10.  * used, modified and distributed under the terms of the MIDAS
  11.  * Sound System license, LICENSE.TXT. By continuing to use,
  12.  * modify or distribute this file you indicate that you have
  13.  * read the license and understand and accept it fully.
  14. */
  15.  
  16.  
  17. #ifndef __midasdll_h
  18. #define __midasdll_h
  19.  
  20.  
  21. /* This is a kluge, but necessary as Watcom C sucks: */
  22. #ifdef EXPORT_IN_MIDASDLL_H
  23.  
  24. #ifdef __WC32__
  25.     #define _FUNC(x) x __export __stdcall
  26. #else
  27.     #define _FUNC(x) __declspec(dllexport) x __stdcall
  28. #endif
  29.  
  30. #else
  31.     #ifdef __LINUX__
  32.         #define _FUNC(x) x
  33.     #else
  34.         #ifdef __DOS__
  35.             #define _FUNC(x) x cdecl
  36.         #else
  37.             #define _FUNC(x) x __stdcall
  38.         #endif
  39.     #endif
  40. #endif
  41.  
  42.  
  43. /* We'll need to define DWORD, BOOL, TRUE and FALSE if someone hasn't
  44.    done that before. For now, we'll just assume that if no-one has defined
  45.    TRUE we need to define everything. There definitions are compatible with
  46.    windows.h. If something else in your system defines these differently,
  47.    things should still work OK as long as FALSE is 0, TRUE is nonzero and
  48.    DWORD is 32-bit. Take care that you don't compare BOOLs like "bool == TRUE"
  49.    in that case though, just use "bool".
  50.  
  51.    THIS IS UGLY AND MAY NEED FIXING!
  52.    ---------------------------------
  53. */
  54.  
  55. #ifndef TRUE
  56. #define TRUE 1
  57. #define FALSE 0
  58. typedef int BOOL;
  59. typedef unsigned long DWORD;
  60. #endif /* ifndef TRUE */
  61.  
  62.  
  63.  
  64. enum MIDASoptions
  65. {
  66.     MIDAS_OPTION_NONE = 0,
  67.     MIDAS_OPTION_MIXRATE,
  68.     MIDAS_OPTION_OUTPUTMODE,
  69.     MIDAS_OPTION_MIXBUFLEN,
  70.     MIDAS_OPTION_MIXBUFBLOCKS
  71. };
  72.  
  73.  
  74. enum MIDASmodes
  75. {
  76.     MIDAS_MODE_NONE = 0,
  77.     MIDAS_MODE_MONO = 1,
  78.     MIDAS_MODE_STEREO = 2,
  79.     MIDAS_MODE_8BIT = 4,
  80.     MIDAS_MODE_16BIT = 8,
  81.     MIDAS_MODE_8BIT_MONO = MIDAS_MODE_8BIT | MIDAS_MODE_MONO,
  82.     MIDAS_MODE_8BIT_STEREO = MIDAS_MODE_8BIT | MIDAS_MODE_STEREO,
  83.     MIDAS_MODE_16BIT_MONO = MIDAS_MODE_16BIT | MIDAS_MODE_MONO,
  84.     MIDAS_MODE_16BIT_STEREO = MIDAS_MODE_16BIT | MIDAS_MODE_STEREO
  85. };
  86.  
  87.  
  88.  
  89. enum MIDASsampleTypes
  90. {
  91.     MIDAS_SAMPLE_NONE = 0,
  92.     MIDAS_SAMPLE_8BIT_MONO = 1,
  93.     MIDAS_SAMPLE_16BIT_MONO = 2,
  94.     MIDAS_SAMPLE_8BIT_STEREO = 3,
  95.     MIDAS_SAMPLE_16BIT_STEREO = 4
  96. };
  97.  
  98.  
  99.  
  100. enum MIDASloop
  101. {
  102.     MIDAS_LOOP_NO = 0,
  103.     MIDAS_LOOP_YES
  104. };
  105.  
  106.  
  107. enum MIDASpanning
  108. {
  109.     MIDAS_PAN_LEFT = -64,
  110.     MIDAS_PAN_MIDDLE = 0,
  111.     MIDAS_PAN_RIGHT = 64,
  112.     MIDAS_PAN_SURROUND = 0x80
  113. };
  114.  
  115.  
  116. enum MIDASchannels
  117. {
  118.     MIDAS_CHANNEL_AUTO = 0xFFFF
  119. };
  120.  
  121.  
  122.  
  123. typedef struct
  124. {
  125.     char        songName[32];
  126.     unsigned    songLength;
  127.     unsigned    numPatterns;
  128.     unsigned    numInstruments;
  129.     unsigned    numChannels;
  130. } MIDASmoduleInfo;
  131.  
  132.  
  133.  
  134. typedef struct
  135. {
  136.     char        instName[32];
  137. } MIDASinstrumentInfo;
  138.  
  139.  
  140.  
  141. typedef struct
  142. {
  143.     unsigned    position;
  144.     unsigned    pattern;
  145.     unsigned    row;
  146.     int         syncInfo;
  147. } MIDASplayStatus;
  148.  
  149.  
  150. typedef void* MIDASmodule;
  151. typedef DWORD MIDASsample;
  152. typedef DWORD MIDASsamplePlayHandle;
  153. typedef void* MIDASstreamHandle;
  154.  
  155.  
  156. #ifdef __cplusplus
  157. extern "C" {
  158. #endif
  159.  
  160. _FUNC(int)      MIDASgetLastError(void);
  161. _FUNC(char*)    MIDASgetErrorMessage(int errorCode);
  162.  
  163. _FUNC(BOOL)     MIDASstartup(void);
  164. _FUNC(BOOL)     MIDASinit(void);
  165. _FUNC(BOOL)     MIDASsetOption(int option, int value);
  166. _FUNC(BOOL)     MIDASclose(void);
  167. _FUNC(BOOL)     MIDASopenChannels(int numChannels);
  168. _FUNC(BOOL)     MIDAScloseChannels(void);
  169. _FUNC(BOOL)     MIDASstartBackgroundPlay(DWORD pollRate);
  170. _FUNC(BOOL)     MIDASstopBackgroundPlay(void);
  171. _FUNC(BOOL)     MIDASpoll(void);
  172. _FUNC(char*)    MIDASgetVersionString(void);
  173.  
  174. _FUNC(MIDASmodule) MIDASloadModule(char *fileName);
  175. _FUNC(BOOL)     MIDASplayModule(MIDASmodule module, int numEffectChannels);                                          // ok
  176. _FUNC(BOOL)     MIDASstopModule(MIDASmodule module);
  177. _FUNC(BOOL)     MIDASfreeModule(MIDASmodule module);
  178.  
  179. _FUNC(BOOL)     MIDASgetPlayStatus(MIDASplayStatus *status);
  180. _FUNC(BOOL)     MIDASsetPosition(int newPosition);
  181. _FUNC(BOOL)     MIDASsetMusicVolume(unsigned volume);
  182. _FUNC(BOOL)     MIDASgetModuleInfo(MIDASmodule module, MIDASmoduleInfo *info);
  183. _FUNC(BOOL)     MIDASgetInstrumentInfo(MIDASmodule module, int instNum,
  184.                     MIDASinstrumentInfo *info);
  185.  
  186. _FUNC(MIDASsample) MIDASloadRawSample(char *fileName, int sampleType,
  187.                     int loopSample);
  188. _FUNC(BOOL)         MIDASfreeSample(MIDASsample sample);
  189. _FUNC(BOOL)         MIDASsetAutoEffectChannels(unsigned firstChannel,
  190.                         unsigned numChannels);
  191. _FUNC(MIDASsamplePlayHandle) MIDASplaySample(MIDASsample sample,
  192.                         unsigned channel, int priority, unsigned rate,
  193.                         unsigned volume, int panning);
  194. _FUNC(BOOL)     MIDASstopSample(MIDASsamplePlayHandle sample);
  195. _FUNC(BOOL)     MIDASsetSampleRate(MIDASsamplePlayHandle sample,
  196.                     unsigned rate);
  197. _FUNC(BOOL)     MIDASsetSampleVolume(MIDASsamplePlayHandle sample,
  198.                     unsigned volume);
  199. _FUNC(BOOL)     MIDASsetSamplePanning(MIDASsamplePlayHandle sample,
  200.                     int panning);
  201. _FUNC(BOOL)     MIDASsetSamplePriority(MIDASsamplePlayHandle sample,
  202.                     int priority);
  203.  
  204. _FUNC(MIDASstreamHandle) MIDASplayStreamFile(unsigned channel, char *fileName,
  205.                     unsigned sampleType, unsigned sampleRate,
  206.                     unsigned bufferLength, int loopStream);
  207. _FUNC(BOOL)     MIDASstopStream(MIDASstreamHandle stream);
  208.  
  209. _FUNC(MIDASstreamHandle) MIDASplayStreamPolling(unsigned channel,
  210.                     unsigned sampleType, unsigned sampleRate,
  211.                     unsigned bufferLength);
  212. _FUNC(unsigned) MIDASfeedStreamData(MIDASstreamHandle stream,
  213.                     unsigned char *data, unsigned numBytes, BOOL feedAll);
  214.  
  215. _FUNC(BOOL)     MIDASsetStreamRate(MIDASstreamHandle stream, unsigned rate);
  216. _FUNC(BOOL)     MIDASsetStreamVolume(MIDASstreamHandle stream,
  217.                     unsigned volume);
  218. _FUNC(BOOL)     MIDASsetStreamPanning(MIDASstreamHandle stream, int panning);
  219.  
  220.  
  221.  
  222.  
  223. #ifdef __cplusplus
  224. }
  225. #endif
  226.  
  227.  
  228.  
  229.  
  230. #endif
  231.  
  232.  
  233. /*
  234.  * $Log: midasdll.h,v $
  235.  * Revision 1.4  1997/01/16 18:41:59  pekangas
  236.  * Changed copyright messages to Housemarque
  237.  *
  238.  * Revision 1.3  1997/01/16 18:26:27  pekangas
  239.  * Added numerous new functions
  240.  *
  241.  * Revision 1.2  1996/09/28 08:12:40  jpaana
  242.  * Fixed for Linux
  243.  *
  244.  * Revision 1.1  1996/09/25 18:38:12  pekangas
  245.  * Initial revision
  246.  *
  247. */